package com.ycxy.school.express.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.ycxy.school.express.pojo.dto.OrderAddNewDTO;
import com.ycxy.school.express.pojo.dto.PaymentAddNewDTO;
import com.ycxy.school.express.service.IPaymentService;
import com.ycxy.school.express.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author jayLuo
 * @Date 2023/1/11 15:36
 * @PackageName:com.ycxy.school.express.controller
 * @ClassName: PaymentController
 * @Description: TODO
 * @Version 1.0
 */
@Slf4j
@Api(tags = "06. 订单支付模块")
@RestController
@RequestMapping("/payments")
public class PaymentController {

    @Autowired
    private IPaymentService paymentService;

    // http://localhost:9080/payments/create
    @ApiOperation("生成订单支付数据")
    @ApiOperationSupport(order = 100)
    @PostMapping("/create")
    public JsonResult<Void> createPayment(PaymentAddNewDTO paymentAddNewDTO) {
        log.debug("开始处理【生成订单数据】的请求，参数：{}", paymentAddNewDTO);
        paymentService.createPayment(paymentAddNewDTO);
        return JsonResult.ok();
    }
}
